<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
  <meta charset="utf-8">
  <title>关于Linux内核学习 &mdash; cat writebug.cn/history</title>
  <meta name="author" content="zhiliao">
  <meta name="description" content="关于Linux内核学习" />

  <meta name="keywords" content="开发者,程序,博客园,程序猿,程序媛,极客,码农,编程,代码,软件开发,开源,IT网站,技术社区,Developer,Programmer,Coder,Geek,Coding,Code,writebug,bug,写bug,linux,vim,编程语言,调试" />

  <link href="/feeds/all.atom.xml" type="application/rss+xml" rel="alternate"
        title="cat writebug.cn/history RSS Feed" />





  <!-- http://t.co/dKP3o1e -->
  <meta name="HandheldFriendly" content="True">
  <meta name="MobileOptimized" content="320">
  <meta name="viewport" content="width=device-width, initial-scale=1">


    <link href="/favicon.png" rel="icon">

  <link href="/theme/css/main.css" media="screen, projection"
        rel="stylesheet" type="text/css">
  <link href="/theme/css/pygment.css" rel="stylesheet" type="text/css">

  <!--
  <link href="//fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic"
        rel="stylesheet" type="text/css">
  <link href="//fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic"
        rel="stylesheet" type="text/css">
  -->


  <script src="/theme/js/modernizr-2.0.js"></script>
  <script src="/theme/js/ender.js"></script>
  <script src="/theme/js/octopress.js" type="text/javascript"></script>
</head>

<body >
  <header role="banner"
  >
<hgroup>
  <h1><a href="/">cat writebug.cn/history</a></h1>
    <h2>一个开发者的技术博客。</h2>
</hgroup></header>
  <nav role="navigation"><ul class="subscription" data-subscription="rss">
  <li><a href="/feeds/all.atom.xml" rel="subscribe-rss">RSS</a></li>
</ul>


<ul class="main-navigation">
    <li><a href="/">Home</a></li>
    <li><a href="/archives.html">Archive</a></li>
    <li><a href="/pages/todolist.html">TodoList</a></li>
    <li><a href="/pages/about.html">About</a></li>
</ul></nav>
  <div id="main">
    <div id="content">
<div>
  <article class="hentry" role="article">
<header>
      <h1 class="entry-title">关于Linux内核学习</h1>
    <p class="meta">
<time datetime="2014-08-15T00:00:00+08:00" pubdate>2014-08-15 00:00:00</time>      
    </p>
</header>

    <div class="entry-content"><div class="highlight-custom"><pre><span></span><code><span class="mf">1.</span><span class="w"> </span><span class="n">请推荐一些好的Linux内核参考书</span><span class="err">？</span><span class="w"> </span>
<span class="n">a</span><span class="mf">.</span><span class="err">《</span><span class="n">Linux</span><span class="w"> </span><span class="n">Device</span><span class="w"> </span><span class="n">Drivers</span><span class="p">,</span><span class="w"> </span><span class="n">Second</span><span class="w"> </span><span class="n">Edition</span><span class="err">》，</span><span class="n">有中文译本</span><span class="w"> </span>
<span class="n">b</span><span class="mf">.</span><span class="err">《</span><span class="n">Understanding</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">Linux</span><span class="w"> </span><span class="n">Kernel</span><span class="p">,</span><span class="w"> </span><span class="mf">2</span><span class="n">nd</span><span class="w"> </span><span class="n">Edition</span><span class="err">》</span><span class="w"> </span>
<span class="n">c</span><span class="mf">.</span><span class="err">《</span><span class="n">Linux内核源代码情景分析</span><span class="err">》，</span><span class="n">分上下两册</span><span class="w"> </span>
<span class="n">d</span><span class="mf">.</span><span class="err">《</span><span class="n">边干边学</span><span class="err">－</span><span class="n">Linux内核指导</span><span class="err">》</span><span class="w"> </span>

<span class="mf">2.</span><span class="w"> </span><span class="n">请推荐一些源代码查看工具</span><span class="err">？</span><span class="w"> </span>
<span class="n">a</span><span class="mf">.</span><span class="w"> </span><span class="n">Windows系统可以用Source</span><span class="w"> </span><span class="n">Insight</span><span class="err">，</span><span class="n">Linux系统可以用Source</span><span class="w"> </span><span class="n">Navigator</span><span class="err">。</span><span class="w"> </span>
<span class="n">b</span><span class="mf">.</span><span class="w"> </span><span class="n">vim或emacs编辑器</span><span class="err">，</span><span class="n">配合cscope</span><span class="err">、</span><span class="n">ctags</span><span class="err">、</span><span class="n">etags等交叉索引工具</span><span class="err">。</span><span class="w"> </span>
<span class="n">c</span><span class="mf">.</span><span class="w"> </span><span class="n">vim或emacs编辑器</span><span class="err">，</span><span class="n">配合grep</span><span class="err">、</span><span class="n">egrep等文本搜索工具</span><span class="err">，</span><span class="n">不过最好要对源代码目录结构有所熟悉</span><span class="w"> </span>
<span class="n">d</span><span class="mf">.</span><span class="w"> </span><span class="n">LXR</span><span class="err">，</span><span class="n">以网页的形式通过浏览器浏览</span><span class="err">，</span><span class="n">安装复杂</span><span class="err">，</span><span class="n">可从http</span><span class="p">:</span><span class="o">//</span><span class="n">lxr</span><span class="mf">.</span><span class="n">linux</span><span class="mf">.</span><span class="n">no</span><span class="o">/</span><span class="n">下</span>
<span class="n">载该工具也可以直接访问http</span><span class="p">:</span><span class="o">//</span><span class="n">lxr</span><span class="mf">.</span><span class="n">linux</span><span class="mf">.</span><span class="n">no</span><span class="o">/</span><span class="n">source</span><span class="o">/</span><span class="n">在线阅读Linux内核源代码</span><span class="err">。</span><span class="w"> </span>

<span class="mf">3.</span><span class="w"> </span><span class="n">为什么看不到用printk打印的信息</span><span class="err">？</span><span class="w"> </span>
<span class="n">a</span><span class="mf">.</span><span class="w"> </span><span class="n">打印消息受级别的限制</span><span class="p">,</span><span class="n">消息级别可以通过printk设置</span><span class="p">,</span><span class="n">如</span><span class="p">:</span><span class="w"> </span>
<span class="kr">print</span><span class="n">k</span><span class="p">(</span><span class="s">&quot;something&quot;</span><span class="p">);</span><span class="w"> </span><span class="o">/*</span><span class="w"> </span><span class="n">其中0</span><span class="o">&lt;=</span><span class="n">n</span><span class="o">&lt;=</span><span class="mf">7</span><span class="w"> </span><span class="o">*/</span><span class="w"> </span>
<span class="n">假设控制台的消息级别为m</span><span class="p">,</span><span class="w"> </span><span class="n">当n</span>
<span class="n">这样一方面可以提高要打印消息本身的级别</span><span class="err">（</span><span class="n">数字越小级别越高</span><span class="err">），</span><span class="w"> </span>
<span class="n">另一方面可以改变控制台的消息级别</span><span class="p">(</span><span class="n">可从1到8</span><span class="p">),</span><span class="n">如改为8可用以下命令</span><span class="p">:</span><span class="w"> </span>
<span class="err">#</span><span class="w"> </span><span class="n">echo</span><span class="w"> </span><span class="s">&quot;8&quot;</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="o">/</span><span class="n">proc</span><span class="o">/</span><span class="kr">sys</span><span class="o">/</span><span class="n">kernel</span><span class="o">/</span><span class="kr">print</span><span class="n">k</span><span class="w"> </span>
<span class="n">b</span><span class="mf">.</span><span class="w"> </span><span class="n">用dmesg命令看</span><span class="err">。</span><span class="w"> </span>
<span class="n">c</span><span class="mf">.</span><span class="w"> </span><span class="n">当系统运行klogd和syslogd时</span><span class="err">，</span><span class="n">内核消息就会由klogd分发到syslogd</span><span class="err">，</span><span class="w"> </span>
<span class="kr">sys</span><span class="nb">log</span><span class="n">d会根据配置文件</span><span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="kr">sys</span><span class="nb">log</span><span class="mf">.</span><span class="n">conf作相应处理</span><span class="err">，</span><span class="n">具体可以查看syslogd</span><span class="w"> </span>
<span class="n">和syslog</span><span class="mf">.</span><span class="n">conf的man页</span><span class="err">。</span><span class="w"> </span>
</code></pre></div></div>
    <footer>
<p class="meta">
  <span class="byline author vcard">
    Posted by <span class="fn">
        zhiliao
    </span>
  </span>
<time datetime="2014-08-15T00:00:00+08:00" pubdate>2014-08-15 00:00:00</time>  <span class="categories">
    <a class='category' href='/category/linux.html'>linux</a>
  </span>
  <span class="categories">
    <a class="category" href="/tag/linux.html">linux</a>,    <a class="category" href="/tag/kernel.html">kernel</a>  </span>
</p><div class="sharing">
</div>    </footer>
  </article>

</div>

<aside class="sidebar">
<section>
  <h1>Recent Posts</h1>
  <ul id="recent_posts">
    <li class="post">
        <a href="/posts/2023/08/22/bash-conversion.html">bash进制转换</a>
    </li>
    <li class="post">
        <a href="/posts/2023/08/16/remap-caps-ctrl.html">在Linux下交换Ctrl与大写锁定键</a>
    </li>
    <li class="post">
        <a href="/posts/2023/08/15/learn-java.html">java入门精粹</a>
    </li>
    <li class="post">
        <a href="/posts/2023/08/04/tcl-expect.html">Tcl 和 expect教程</a>
    </li>
    <li class="post">
        <a href="/posts/2023/08/01/armbian-config-software.html">armbian-config 支持自动安装的软件</a>
    </li>
  </ul>
</section><section>
  <h1>Categories</h1>
    <ul id="recent_posts">
      <li><a href="/category/android.html">android (2)</a></li>
      <li><a href="/category/blog.html">blog (1)</a></li>
      <li><a href="/category/bootloader.html">bootloader (2)</a></li>
      <li><a href="/category/container.html">container (1)</a></li>
      <li><a href="/category/database.html">database (1)</a></li>
      <li><a href="/category/editor.html">editor (4)</a></li>
      <li><a href="/category/filesystem.html">filesystem (1)</a></li>
      <li><a href="/category/firefox.html">firefox (1)</a></li>
      <li><a href="/category/git.html">git (4)</a></li>
      <li><a href="/category/golang.html">golang (1)</a></li>
      <li><a href="/category/gu-piao.html">股票 (1)</a></li>
      <li><a href="/category/ide.html">IDE (1)</a></li>
      <li><a href="/category/interview.html">interview (1)</a></li>
      <li><a href="/category/linux.html">linux (51)</a></li>
      <li><a href="/category/network.html">network (7)</a></li>
      <li><a href="/category/nltk.html">nltk (2)</a></li>
      <li><a href="/category/notes.html">notes (1)</a></li>
      <li><a href="/category/other.html">other (1)</a></li>
      <li><a href="/category/programming.html">programming (10)</a></li>
      <li><a href="/category/python.html">python (1)</a></li>
      <li><a href="/category/software.html">software (1)</a></li>
      <li><a href="/category/stock.html">stock (1)</a></li>
      <li><a href="/category/storage.html">storage (2)</a></li>
      <li><a href="/category/vm.html">vm (1)</a></li>
      <li><a href="/category/web.html">web (4)</a></li>
      <li><a href="/category/windows.html">windows (1)</a></li>
      <li><a href="/category/xwindow.html">xwindow (1)</a></li>
  </ul>
</section>
<section>
  <h1>Tags</h1>
    <a href="/tag/linux.html">linux</a>,    <a href="/tag/bash.html">bash</a>,    <a href="/tag/xwindow.html">Xwindow</a>,    <a href="/tag/programming-language.html">programming-language</a>,    <a href="/tag/java.html">java</a>,    <a href="/tag/programming.html">programming</a>,    <a href="/tag/software.html">software</a>,    <a href="/tag/storage.html">storage</a>,    <a href="/tag/debug.html">debug</a>,    <a href="/tag/c.html">C</a>,    <a href="/tag/git.html">git</a>,    <a href="/tag/patch.html">patch</a>,    <a href="/tag/text.html">text</a>,    <a href="/tag/selenium.html">selenium</a>,    <a href="/tag/web.html">web</a>,    <a href="/tag/docker.html">docker</a>,    <a href="/tag/flatpak.html">flatpak</a>,    <a href="/tag/interview.html">interview</a>,    <a href="/tag/qt.html">Qt</a>,    <a href="/tag/opensuse.html">openSUSE</a>,    <a href="/tag/filesystem.html">filesystem</a>,    <a href="/tag/ide.html">IDE</a>,    <a href="/tag/glang.html">glang</a>,    <a href="/tag/xdg.html">xdg</a>,    <a href="/tag/network.html">network</a>,    <a href="/tag/raspberry.html">raspberry</a>,    <a href="/tag/vm.html">vm</a>,    <a href="/tag/windows.html">windows</a>,    <a href="/tag/gdb.html">gdb</a>,    <a href="/tag/debian.html">debian</a>,    <a href="/tag/archlinux.html">archlinux</a>,    <a href="/tag/phicomm.html">phicomm</a>,    <a href="/tag/kernel.html">kernel</a>,    <a href="/tag/ext4.html">ext4</a>,    <a href="/tag/server.html">server</a>,    <a href="/tag/stock.html">stock</a>,    <a href="/tag/shu.html">书</a>,    <a href="/tag/gu-piao.html">股票</a>,    <a href="/tag/python.html">python</a>,    <a href="/tag/nltk.html">nltk</a>,    <a href="/tag/command.html">command</a>,    <a href="/tag/shell.html">shell</a>,    <a href="/tag/terminal.html">terminal</a>,    <a href="/tag/other.html">other</a>,    <a href="/tag/wireless.html">wireless</a>,    <a href="/tag/android.html">android</a>,    <a href="/tag/gtk.html">gtk+</a>,    <a href="/tag/gnome.html">gnome</a>,    <a href="/tag/keyboard.html">keyboard</a>,    <a href="/tag/firefox.html">firefox</a>,    <a href="/tag/arch.html">arch</a>,    <a href="/tag/database.html">database</a>,    <a href="/tag/mysql.html">mysql</a>,    <a href="/tag/notes.html">notes</a>,    <a href="/tag/sysctl.html">sysctl</a>,    <a href="/tag/vim.html">vim</a>,    <a href="/tag/editor.html">editor</a>,    <a href="/tag/pelican.html">pelican</a>,    <a href="/tag/blog.html">blog</a>,    <a href="/tag/book.html">book</a>,    <a href="/tag/bootloader.html">bootloader</a></section>
    <section>
        <h1>Social</h1>
        <ul>
            <li><a href="https://github.com/zhangjiaxing" target="_blank">github</a></li>
            <li><a href="http://wpa.qq.com/msgrd?v=3&uin=347820393&site=qq&menu=yes" target="_blank">qq</a></li>
            <li><a href="http://www.writebug.cn" target="_blank">blog</a></li>
            <li><a href="http://gallery.writebug.cn" target="_blank">gallery</a></li>
        </ul>
    </section>
    <section>
        <h1>Blogroll</h1>
        <ul>
            <li><a href="http://getpelican.com/" target="_blank">Pelican</a></li>
        </ul>
    </section>

</aside>
    </div>
  </div>
  <footer role="contentinfo">
<p>
    Copyright &copy;  2013&ndash;2023  zhiliao &mdash;
  <span class="credit">Powered by <a href="http://getpelican.com">Pelican</a></span>
</p>  </footer>
</body>
</html>